home *** CD-ROM | disk | FTP | other *** search
/ CD Exchange / CD Exchange - Volume 1.iso / d.t.p / utils / propage / donsgenies / donsgenies.lha / Don'sGenies / BoxesFrontToBack.pprx < prev    next >
Text File  |  1993-08-06  |  4KB  |  125 lines

  1. /* Boxes Front to Back
  2. Select boxes by name or number and rearrange them from front to back in order. Useful in complex layouts where there are several boxes on top of each other.
  3. You will be given a list of boxes, and asked to double-click on the names in order from front to back. You can click on Cancel at any time to finish the process. 
  4. Written by Don Cox © Aug 92  Debug + Mods by Fabien Larini, Aug.93 */
  5.  
  6. signal on error
  7. signal on syntax
  8. call ppm_AutoUpdate(0)
  9. cr = "0a"x
  10.  
  11. trace n
  12.  
  13. address command
  14. call SafeEndEdit.rexx()
  15.  
  16. call ppm_ShowStatus("Making List of Boxes ...")
  17. thispage = ppm_CurrentPage()
  18. totalboxes = ppm_NumBoxes(thispage)
  19. list = ""
  20. numberlist = ""
  21. box = ppm_PageFirstBox(thispage)
  22. do i = 1 to totalboxes
  23.     number = right(ppm_BoxNum(box),3," ")
  24.     numberlist = numberlist" "number 
  25.     info = ppm_GetBoxInfo(box)
  26.     boxtype = word(info,1)
  27.     boxname = ppm_GetBoxName(box)
  28.     select
  29.         when upper(boxtype) = "TEXT" then do
  30.             boxtext = ppm_GetBoxText(box,0)
  31.             shorttext = substr(boxtext,1,15)
  32.             if boxname = "" then boxname = shorttext
  33.             end
  34.         when upper(boxtype) = "BITMAP" then do
  35.             filename = word(info,5)
  36.             filename = substr(filename, lastpos("/",filename)+1)
  37.             if boxname = "" then boxname = filename
  38.             end
  39.         when upper(boxtype) = "EPSF" then do
  40.             filename = word(info,3)
  41.             filename = substr(filename, lastpos("/",filename)+1)
  42.             if boxname = "" then boxname = filename
  43.             end
  44.         when upper(boxtype) = "CLIP" then do
  45.             objects = "Clip, "||word(info,2)||" objects"
  46.             if boxname = "" then boxname = objects
  47.             end
  48.         when upper(boxtype) = "STRUCTURED" then do
  49.             objects = "Struct., "||word(info,2)||" objects"
  50.             if word(info,2)=1 then objects = "Struct., 1 object"
  51.             if boxname = "" then boxname = objects
  52.             end
  53.         when upper(boxtype) = "EMPTY" then do
  54.             if boxname = "" then boxname = "Empty"
  55.             end
  56.         otherwise boxname = "Unknown type of box"
  57.     end
  58.     boxtype = substr(boxtype,1,1)
  59.     list = list||number" "boxname||cr
  60.     box = ppm_PageNextBox(box)
  61.     end
  62.  
  63. call ppm_ClearStatus()
  64. form = ""
  65. series = ""
  66.     box = ppm_SelectFromList("Double-click front box",34,18,0,list)
  67.     if box = "" then exit_msg("Abandon Genie")
  68.     series = series||" "||word(box,1)
  69.     form = box||":1"||"0a"x
  70.  
  71. do i = 2 to totalboxes
  72.     box = ppm_SelectFromList("Double-click next box",34,18,0,list)
  73.     if box = "" then break
  74.     series = series||" "||word(box,1)
  75.     form = form||box":"||i||"0a"x
  76.     end
  77.  
  78. form = delstr(form,length(form),1) /* line added by F. Larini */
  79. accept = ppm_GetForm("Is this OK?",3,form)
  80. if accept = "" then exit_msg("Aborted by user ")
  81.  
  82. newnumbers = numberlist
  83. numselected = words(series)
  84. do i=1 to numselected
  85.     this = word(series,i)
  86.     do w = 1 to words(numberlist)
  87.         that = word(numberlist,w)
  88.         chars = length(that)
  89.         pad = left("XXXXXX",chars)
  90.         pad = " "pad" "
  91.         position = wordindex(newnumbers,w)+(chars-1) /* changed Aug. 93 */
  92.         if this = that then do
  93.             newnumbers = insert(pad,newnumbers,position)
  94.             newnumbers = delword(newnumbers,w,1)
  95.             leave w
  96.             end
  97.         end
  98.     end
  99. newnumbers = compress(newnumbers,"X")
  100.  
  101. series = series||" "||newnumbers /* stick the unselected boxes on the end of the list */
  102.  
  103. do until series = ""
  104.     parse var series box series
  105.     call ppm_BoxToBack(box)
  106.     end
  107.  
  108. exit_msg()
  109.  
  110. error:
  111. syntax:
  112.     do
  113.     exit_msg("Genie failed due to error: "errortext(rc))
  114.     end
  115.  
  116. exit_msg:
  117.     do
  118.     parse arg message
  119.     if message ~= "" then
  120.     call ppm_Inform(1,message,"Resume")
  121.     call ppm_ClearStatus()
  122.     call ppm_AutoUpdate(1)
  123.     exit
  124.     end
  125.